package pack2;

import java.lang.reflect.Field;

public class TestHeracy {

    public static void main(String[] args) throws ClassNotFoundException {
        //用反射查看子类究竟有没有得到父类所有成员变量以及方法
        Class fatherClass = Class.forName("pack1.Test1");
        Class childClass = Class.forName("pack2.Test4");
        //看父类

        Field[] declaredFields = fatherClass.getDeclaredFields();
        for (Field field: declaredFields) {
            System.out.println(field);
        }
        System.out.println("==============");
        //看子类
        declaredFields = childClass.getDeclaredFields();
        for (Field field: declaredFields) {
            System.out.println(field);
        }
    }
}
